﻿package view.components.footer 
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.FullScreenEvent;
	import view.components.IMainComponent;
	
	/**
	 * ...
	 * @author ...
	 */
	public class Footer extends Sprite implements IMainComponent
	{
		
		private var _footerbg:Sprite;
		private var _musicPlayer:MovieClip;
		private var _vkBut:MovieClip;
		private var _madeBy:MovieClip;
		private var _fullscreen:MovieClip;
		
		public function Footer($songXml:XMLList) 
		{
			//Draw footer bg
			_footerbg = new Sprite();
			_footerbg.graphics.beginFill(0x000000, .6);
			_footerbg.graphics.drawRect(0, 0, 100, 20);
			_footerbg.graphics.endFill();
			
			//create music player
			_musicPlayer = new MusicPlayer($songXml.music);
			// link vkontakte group
			_vkBut = new VkBut($songXml);
			// made by Lobanov :D
			_madeBy = new MadeBy($songXml);
			// Fullscreen mode
			_fullscreen = new FullScreenBut();
			
			//init in display
			this.addChild(_footerbg);
			this.addChild(_musicPlayer);
			this.addChild(_vkBut);
			this.addChild(_madeBy);
			this.addChild(_fullscreen);
		}
		
		public function setPosition($width:Number, $height:Number):void 
		{
			_footerbg.width = $width;
			_footerbg.y = $height - 20;
			
			_musicPlayer.x = $width - 90;
			_musicPlayer.y = _vkBut.y = _madeBy.y = _fullscreen.y = $height - 16;
			
			_vkBut.x = $width - 159;
			_madeBy.x = 45;
			_fullscreen.x = $width - 25;
		}
	}

}